<extend name="Public/base" />
<!-- 子导航 -->
<block name="sidebar">
    <include file="sidemenu" />
</block>

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>专题列表</h2>
    </div>
    <div class="cf">
        <div class="fl">
            <a class="btn" href="{:U('add')}">新 增</a>
          <!--  <button class="btn ajax-post" url="{:U('changeStatus',array('method'=>'resume'))}" target-form="ids">启 用</button>
            <button class="btn ajax-post" url="{:U('changeStatus',array('method'=>'forbid'))}" target-form="ids">禁 用</button>
            <button class="btn ajax-post confirm" url="{:U('changeStatus',array('method'=>'delete'))}" target-form="ids">删 除</button>-->
        </div>

        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <div class="sleft">
                <input type="text" name="nickname" class="search-input" value="{:I('name')}" placeholder="请输入搜索内容">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>
   <!-- 弹出 -->
	       <style> 

        .white_content { 
            display: none; 
            position: absolute; 
  height: 15%;
    left: 68%;

    top: 33%;
    width: 16%;
            padding: 20px; 
            border: 4px solid #4bbd00; 
            background-color: white; 
            z-index:1002; 
            overflow: auto; 
        } 
    </style> 


        <div id="light" class="white_content">
		<form action="{:U('addxin')}"  method="post" class="form-horizontal">
		           <label class="textarea">
                   <textarea name="allid" id="allid" placeholder="输入文章id 多个 , 分开"></textarea>
								 </label>
                    <input type="hidden" value="" id="zid" name="zid" />
		      
				               <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
        
			<a class="btn" onclick="document.getElementById('light').style.display='none';" href="javascript:void(0);">关闭</a>
        </form>
		</div> 

    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <table class="">
            <thead>
            <tr>
                <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
				
                <th>编号</th>
					<th>排序</th>
				<th>标题</th>
				<th>创建人</th>
				<th>创建时间</th>
	
			<th>缩略图</th>
			
				<th>推荐位</th>
				
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <notempty name="_list">
                <volist name="_list" id="vo">	
                    <tr>
                        <td><input class="ids" type="checkbox" name="id[]" value="{$vo.id}" /></td>
                        <td>{$vo.id}</td>
						<td><input type="text" name="sort" data_id="{$vo.id}"  class="text input-mini" value="{$vo.disorder}"></td>
						<td>{$vo.title}</td>
						<td>{$vo.auther}</td>
						<td>{$vo.addtime|date='Y-m-d',###}</td>
						<td><img src="{$vo.thumb|get_cover='path'}" style="width:20%;"/></td>
						<td><font color="red">
			<foreach name="Think.config.DOCUMENT_POSITION" item="vos">
			<eq name="vo.position" value="$key">{$vos}<else/></eq>&nbsp;
			</foreach>
</font></td>     
                        <td>
						 <a href="{:U('edit?&id='.$vo['id'])}" >编辑</a>
<a href="javascript:void(0);" onclick = "document.getElementById('light').style.display='block';document.getElementById('zid').value={$vo.id};document.getElementById('allid').innerHTML='';">添加信息</a>
						  <a href="{:U('spec/mydocument?zid='.$vo['id'])}" >管理信息</a>
				
						<eq name="vo.status" value="1">
                            <a href="{:U('changeStatus?method=forbid&id='.$vo['id'])}" class="ajax-get">禁用</a>
                            <else/>
                            <a href="{:U('changeStatus?method=resume&id='.$vo['id'])}" class="ajax-get">启用</a>
                        </eq>
						
                            <a href="{:U('changeStatus?method=delete&id='.$vo['id'])}" class="confirm ajax-get">删除</a>
                        </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
            </tbody>
        </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>





<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">

	$("input[name='sort']").on("blur",function(){
	  var  id = $(this).attr('data_id'); 
	  var  sort = $(this).val();
	                	$(this).after('<font>&nbsp;&nbsp;&nbsp;编辑成功</font>');	
									setTimeout(function(){
								
									$(this).next().remove();
							
							}, 1000);		
		
	  	$.post('?s=Spec/Upsort',{id:id,sort:sort}, function(data){

	    });
	});
        //搜索功dd能
        $("#search").click(function(){
            var url = $(this).attr('url');
            var query  = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function(e){
            if(e.keyCode === 13){
                $("#search").click();
                return false;
            }
        });
        //导航高亮
        highlight_subnav('{:U('index')}');
    </script>
</block>
